/******************************************************************************
 * * setting_time.c - implementation of time setting functions
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/

#include "setting_global.h"

Setting_Time_Setting_Mng_t           g_SettingTimeSettingMng;                             // for time setting manage
VOID                                 *gp_SettingTimeSettingCurUIDesc              = NULL; // Current UI description
VOID                                 *gp_SettingTimeSettingCurContainerListUIDesc = NULL; // Current Normal_Container_List UI description

ACTIVITY_ID                          g_SettingTimeScrollCaller;                           // ACT_ID_SETTING_CLOCK_SETTING, ACT_ID_SETTING_PROFILE_SETTING
extern Setting_Profile_Setting_Mng_t *g_SettingProfileMng;
extern Setting_Tone_Setting_Mng_t    g_SettingToneSettingMng;

/**
 * sub-module entry
 * param (in) void
 * return  void
 */
VOID Setting_Time_Main(VOID)
{
    // init manage variable
}

/**
 * sub-module event handler
 * param (in) void
 * return  void
 */
VOID Setting_Time_Event_handle(VOID)
{
    // event and message dispatch
}

/**
 * initiate time sub-module
 * param (in) pNvPara: NV_UI_Settings_t*
 * return  void
 */
VOID Setting_Time_Init_Req(NV_UI_Settings_t *pNvPara)
{
    // init manage variable
    if (0 == pNvPara->TimeSetting.TimeFormat)
    {
        g_SettingTimeSettingMng.TimeFormat = SETTING_TIME_FORMAT_12H;
    }
    else
    {
        g_SettingTimeSettingMng.TimeFormat = SETTING_TIME_FORMAT_24H; 
    }
    
    if (0 == pNvPara->TimeSetting.TimeDisplay)
    {
        g_SettingTimeSettingMng.TimeDisplay = SETTING_TIME_HIDE;
    }
    else
    {
        g_SettingTimeSettingMng.TimeDisplay = SETTING_TIME_SHOW;
    }
    
    if (0 == pNvPara->TimeSetting.TimeAutoUpdate)
    {
        g_SettingTimeSettingMng.TimeAutoUpdate = SETTING_TIME_AUTO_UPDATE_OFF;
    }
    else
    {
        g_SettingTimeSettingMng.TimeAutoUpdate = SETTING_TIME_AUTO_UPDATE_ON;
#ifndef BUILD_IN_PC_SIMULATOR
        Setting_Set_Rtc_Time(NULL); 
#endif
    }
}

/**
 * get time display mode
 * param (out) TimeDisplay: If_Setting_Time_Display_t
 * return  void
 */
VOID Setting_Get_Time_Display_Req(If_Setting_Time_Display_t *TimeDisplay)
{
    // get the current time display setting
    if (SETTING_TIME_HIDE == g_SettingTimeSettingMng.TimeDisplay)
    {
        TimeDisplay->TimeDisplay = IF_SETTING_TIME_HIDE;
    }
    else
    {
        TimeDisplay->TimeDisplay = IF_SETTING_TIME_SHOW;
    }

    // get the current time format setting
    if (SETTING_TIME_FORMAT_12H == g_SettingTimeSettingMng.TimeFormat)
    {
        TimeDisplay->TimeFormat = IF_SETTING_TIME_FORMAT_12H;
    }
    else
    {
        TimeDisplay->TimeFormat = IF_SETTING_TIME_FORMAT_24H;
    }
}

/**
 * Set time display mode
 * param (in) TimeDisplay: SETTING_TIME_DISPLAY
 * return void:
 */
VOID Setting_Set_Time_Display(SETTING_TIME_DISPLAY TimeDisplay)
{
    UINT8                   nvData[3];
    Setting_Phone_Setting_t *PhoneSetting = NULL;

    // change global variable
    g_SettingTimeSettingMng.TimeDisplay = TimeDisplay;

    // write NV
    nvData[0] = (UINT8)g_SettingTimeSettingMng.TimeFormat;
    nvData[1] = (UINT8)g_SettingTimeSettingMng.TimeDisplay;
    nvData[2] = (UINT8)g_SettingTimeSettingMng.TimeAutoUpdate;
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, NV_SETTING_TIME_SETTING_OFFSET, NV_SETTING_TIME_SETTING_LEN, nvData);

    // notify framework
    PhoneSetting = (Setting_Phone_Setting_t *)Hal_Mem_Alloc(sizeof(Setting_Phone_Setting_t));
    Hal_Mem_Set(PhoneSetting, 0, sizeof(Setting_Phone_Setting_t));

    PhoneSetting->ChangeMark = IF_SETTING_CHANGE_MARK_TIME_DISPLAY;
    if (SETTING_TIME_HIDE == g_SettingTimeSettingMng.TimeDisplay)
    {
        PhoneSetting->TimeDisplay.TimeDisplay = IF_SETTING_TIME_HIDE;
    }
    else
    {
        PhoneSetting->TimeDisplay.TimeDisplay = IF_SETTING_TIME_SHOW;
    }

    if (SETTING_TIME_FORMAT_12H == g_SettingTimeSettingMng.TimeFormat)
    {
        PhoneSetting->TimeDisplay.TimeFormat = IF_SETTING_TIME_FORMAT_12H;
    }
    else
    {
        PhoneSetting->TimeDisplay.TimeFormat = IF_SETTING_TIME_FORMAT_24H;
    }

    Setting_Phone_Setting_Chg_Ind(PhoneSetting);
}

/**
 * Set time display format
 * param (in) TimeFormat: SETTING_TIME_FORMAT
 * return void:
 */
VOID Setting_Set_Time_Format(SETTING_TIME_FORMAT TimeFormat)
{
    UINT8                   nvData[3];
    Setting_Phone_Setting_t *PhoneSetting = NULL;

    // change global variable
    g_SettingTimeSettingMng.TimeFormat = TimeFormat;

    // nv write
    nvData[0] = (UINT8)g_SettingTimeSettingMng.TimeFormat;
    nvData[1] = (UINT8)g_SettingTimeSettingMng.TimeDisplay;
    nvData[2] = (UINT8)g_SettingTimeSettingMng.TimeAutoUpdate;
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, NV_SETTING_TIME_SETTING_OFFSET, NV_SETTING_TIME_SETTING_LEN, nvData);

    // inform framework
    PhoneSetting = (Setting_Phone_Setting_t *)Hal_Mem_Alloc(sizeof(Setting_Phone_Setting_t));
    Hal_Mem_Set(PhoneSetting, 0, sizeof(Setting_Phone_Setting_t));

    PhoneSetting->ChangeMark = IF_SETTING_CHANGE_MARK_TIME_DISPLAY;
    if (SETTING_TIME_HIDE == g_SettingTimeSettingMng.TimeDisplay)
    {
        PhoneSetting->TimeDisplay.TimeDisplay = IF_SETTING_TIME_HIDE;
    }
    else
    {
        PhoneSetting->TimeDisplay.TimeDisplay = IF_SETTING_TIME_SHOW;
    }

    if (SETTING_TIME_FORMAT_12H == g_SettingTimeSettingMng.TimeFormat)
    {
        PhoneSetting->TimeDisplay.TimeFormat = IF_SETTING_TIME_FORMAT_12H;
    }
    else
    {
        PhoneSetting->TimeDisplay.TimeFormat = IF_SETTING_TIME_FORMAT_24H;
    }

    Setting_Phone_Setting_Chg_Ind(PhoneSetting);
}

/**
 * Set time atuo update
 * param (in) TimeAutoUpdate: SETTING_TIME_AUTO_UPDATE
 * return void:
 */
VOID Setting_Set_Time_Auto_Update(SETTING_TIME_AUTO_UPDATE TimeAutoUpdate)
{
    UINT8 nvData[3];

    // change global variable
    g_SettingTimeSettingMng.TimeAutoUpdate = TimeAutoUpdate;

    // nv write
    nvData[0] = (UINT8)g_SettingTimeSettingMng.TimeFormat;
    nvData[1] = (UINT8)g_SettingTimeSettingMng.TimeDisplay;
    nvData[2] = (UINT8)g_SettingTimeSettingMng.TimeAutoUpdate;
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, NV_SETTING_TIME_SETTING_OFFSET, NV_SETTING_TIME_SETTING_LEN, nvData);

    // inform framework(unnecessary, framework doesn't care time auto-update or not)
}

/**
 * Set RTC time
 * param (in) Time: hal_rtc_t
 * return void:
 */
VOID Setting_Set_Rtc_Time(hal_rtc_t *Time)
{
    // call hal interface
    Hal_Rtc_Settime(Time);
}

/**
 * Get RTC time
 * param (in) Time: hal_rtc_t
 * return void:
 */
VOID Setting_Get_Rtc_Time(hal_rtc_t *Time)
{
    // call hal interface
    Hal_Rtc_Gettime(Time);
}

/**
 * time auto-update indication
 * param (in) TimeInfo: MMI_Modem_Time_Info_t*
 * return  void
 */
VOID Phone_Modem_Time_Update_Ind(MMI_Modem_Time_Info_t *TimeInfo)
{
#if 0
    hal_rtc_t *Time = NULL;

    Time = (hal_rtc_t *)Hal_Mem_Alloc(sizeof(hal_rtc_t));
    Hal_Mem_Set(Time, 0, sizeof(hal_rtc_t));

    Time->tm_sec  = TimeInfo->tm_sec;
    Time->tm_min  = TimeInfo->tm_min;
    Time->tm_hour = TimeInfo->tm_hour;
    Time->tm_mday = TimeInfo->tm_mday;
    Time->tm_mon  = TimeInfo->tm_mon;
    Time->tm_year = TimeInfo->tm_year;

    Setting_Set_Rtc_Time(Time);
#endif

    Hal_Mem_Free(TimeInfo);
}

/**
 *
 * Callback of Setting_Time_Scroll, on destroy
 * param (in) pNormalTimeDesc: UI_Normal_Time_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Scroll_Destroy(VOID *pPara)
{
    Hal_Mem_Free(pPara);
}

/**
 *
 * Callback of Setting_Time_Scroll, on restore state
 * param (in) pNormalTimeDesc: UI_Normal_Time_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Scroll_RestoreState(VOID *pNormalTimeDesc)
{
    gp_SettingTimeSettingCurUIDesc = pNormalTimeDesc;
}

/**
 *
 * Callback of Setting_Time_Scroll, on save state
 * param (in) pNormalTimeDesc: UI_Normal_Time_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Scroll_OnSaveState(VOID *pNormalTimeDesc)
{
    UI_Normal_Time_Desc_t *Desc = pNormalTimeDesc;

    INT8 Buf[3] = {0};
    lv_roller_get_selected_str(Desc->ContTime.Roller1.Roller, Buf, 3);
    Desc->ContTime.Roller1.MidValue = atoi(Buf);
    lv_roller_get_selected_str(Desc->ContTime.Roller2.Roller, Buf, 3);
    Desc->ContTime.Roller2.MidValue = atoi(Buf);
}

/**
 *
 * Callback of Setting_Time_Scroll, OK button
 * param (in) void:
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Time_Scroll_OK()
{
    hal_rtc_t             RtcTime, SetTime;
    UI_Normal_Time_Desc_t *pNormalTimeDesc;
    UINT32                TimerLen = 0;
    UI_PHONE_TEXT_ID      TxtId    = LV_LANG_TXT_ID_NONE;
    UINT8 Para = 0;
    INT8 Buf[3] = {0};
    
    pNormalTimeDesc = (UI_Normal_Time_Desc_t *)gp_SettingTimeSettingCurUIDesc;

    // Get the current time
    Setting_Get_Rtc_Time(&RtcTime);

    // set new time according to roller options
    lv_roller_get_selected_str(pNormalTimeDesc->ContTime.Roller1.Roller, Buf, 3);
    SetTime.tm_hour = atoi(Buf);
    lv_roller_get_selected_str(pNormalTimeDesc->ContTime.Roller2.Roller, Buf, 3);
    SetTime.tm_min  = atoi(Buf);

    if (ACT_ID_SETTING_CLOCK_SETTING == g_SettingTimeScrollCaller)
    {
        RtcTime.tm_hour = SetTime.tm_hour;
        RtcTime.tm_min  = SetTime.tm_min;
        RtcTime.tm_sec  = 0;

        // set RTC using new time
        Setting_Set_Rtc_Time(&RtcTime);
        Setting_Set_Time_Auto_Update(SETTING_TIME_AUTO_UPDATE_OFF);
        Display_Setting_Done(ACT_ID_SETTING_TIME_SCROLL, PHONE_TEXT_ID_TIME_IS_SET, ACT_ID_SETTING_TIME_SETTINGS);

        Setting_Time_Change_Ind();
    }
    else if (ACT_ID_SETTING_PROFILE_SETTING == g_SettingTimeScrollCaller)
    {
        // set new time according to roller options
        if (SetTime.tm_hour >= RtcTime.tm_hour)
        {
            if (SetTime.tm_min >= RtcTime.tm_min)
            {
                if(RtcTime.tm_sec) {
                    TimerLen = (SetTime.tm_hour - RtcTime.tm_hour) * 3600 * 1000 + (SetTime.tm_min - RtcTime.tm_min - 1) * 60 * 1000 + (60 - RtcTime.tm_sec) * 1000;
                } else {
                    TimerLen = (SetTime.tm_hour - RtcTime.tm_hour) * 3600 * 1000 + (SetTime.tm_min - RtcTime.tm_min) * 60 * 1000;
                }
            }
            else if (SetTime.tm_min < RtcTime.tm_min)
            {
                if (SetTime.tm_hour > RtcTime.tm_hour)
                {
                    if(RtcTime.tm_sec) {
                        TimerLen = (SetTime.tm_hour - RtcTime.tm_hour - 1) * 3600 * 1000 + (SetTime.tm_min + 60 - RtcTime.tm_min - 1) * 60 * 1000 + (60 - RtcTime.tm_sec) * 1000;
                    } else {
                        TimerLen = (SetTime.tm_hour - RtcTime.tm_hour - 1) * 3600 * 1000 + (SetTime.tm_min + 60 - RtcTime.tm_min) * 60 * 1000;
                    }
                }
                else
                {
                    if(RtcTime.tm_sec) {
                        TimerLen = (SetTime.tm_hour + 24 - RtcTime.tm_hour - 1) * 3600 * 1000 + (SetTime.tm_min + 60 - RtcTime.tm_min - 1) * 60 * 1000 + (60 - RtcTime.tm_sec) * 1000;
                    } else {
                        TimerLen = (SetTime.tm_hour + 24 - RtcTime.tm_hour - 1) * 3600 * 1000 + (SetTime.tm_min + 60 - RtcTime.tm_min) * 60 * 1000;
                    }
                }
            }
        }

        // Create & start profile timer
        if (0 != TimerLen)
        {
            g_SettingProfileSettingProfileTimer = Hal_Timer_Start(TimerLen, Display_Setting_Timed_Profile_Timeout, (VOID *)&Para, FALSE);

            // Copy profile to tone setting manage variable
            g_SettingProfileOperatingIdx = g_SettingProfileMng->CurrentEditingIdx;
            Setting_Update_Profile_Para(2, 1);
            Setting_Update_Profile_Para(3, g_SettingProfileOperatingIdx);
            Hal_Mem_Copy(&g_SettingToneSettingMng, &g_SettingProfileMng->ProfileSetting[g_SettingProfileMng->CurrentEditingIdx],sizeof(Setting_Tone_Setting_Mng_t));

            switch (g_SettingProfileMng->CurrentEditingIdx)
            {
            case SETTING_PROFILE_GENERAL:
                TxtId = PHONE_TEXT_ID_GENERAL;
                Setting_Ring_Silent_Ind(FALSE);
                break;

            case SETTING_PROFILE_SILENT:
                TxtId = PHONE_TEXT_ID_SILENT;
                Setting_Ring_Silent_Ind(TRUE);
                break;

            case SETTING_PROFILE_DISCREET:
                TxtId = PHONE_TEXT_ID_DISCREET;
                Setting_Ring_Silent_Ind(FALSE);
                break;

            case SETTING_PROFILE_LOUD:
                TxtId = PHONE_TEXT_ID_LOUD;
                Setting_Ring_Silent_Ind(FALSE);
                break;

            case SETTING_PROFILE_MY_STYLE:
                TxtId = PHONE_TEXT_ID_MY_STYLE;
                Setting_Ring_Silent_Ind(FALSE);
                break;
            }
            Display_Setting_Done(ACT_ID_SETTING_TIME_SCROLL, TxtId, ACT_ID_DESKTOP);
        }
        else
        {
            Display_Setting_Error_Profile();
        }
    }
    // return to previous screen
    // Nav_Back(ACT_ID_SETTING_TIME_SCROLL);

    return(1);
} /* Display_Setting_Time_Scroll_OK */

/**
 *
 * Callback of Setting_Time_Scroll, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Time_Scroll_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    if (KEY_RELEASED != key_sta)
    {
        return(0);
    }

    if (KEY_UP == key_val)
    {
        // use the default handling of lv_roller
        return(0);
    }
    else if (KEY_DOWN == key_val)
    {
        // use the default handling of lv_roller
        return(0);
    }
    else if (KEY_OK == key_val)
    {
        return(Display_Setting_Time_Scroll_OK());
    }
    else if (KEY_SOFTRIGHT == key_val)   // BACK
    {
        Nav_Back(ACT_ID_SETTING_TIME_SCROLL);
        return(1);
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        return(1);
    }
    else
    {
        return(0);
    }
}

/**
 *
 * display Setting_Time_Scroll
 * param (in) CallerActId: ACTIVITY_ID
 * return void:
 */
VOID Display_Setting_Time_Scroll(ACTIVITY_ID CallerActId)
{
    Nav_Func_List_t       FuncList;
    UI_Normal_Time_Desc_t *pNormalTimeDesc;
    hal_rtc_t             Time;

    // Alloc memory for time scroll UI display
    pNormalTimeDesc = Hal_Mem_Alloc(sizeof(UI_Normal_Time_Desc_t));
    Hal_Mem_Set(pNormalTimeDesc, 0, sizeof(UI_Normal_Time_Desc_t));

    // Set the UI description parameters
    if (ACT_ID_SETTING_CLOCK_SETTING == CallerActId)
    {
        pNormalTimeDesc->TitleBar.TxtId = PHONE_TEXT_ID_TIME;
    }
    else if (ACT_ID_SETTING_PROFILE_SETTING == CallerActId)
    {
        pNormalTimeDesc->TitleBar.TxtId = PHONE_TEXT_ID_PROFLLE_EXPIRES;
    }

    pNormalTimeDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pNormalTimeDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    // Get the current time
    Setting_Get_Rtc_Time(&Time);
    pNormalTimeDesc->ContTime.Roller1.MidValue     = Time.tm_hour;
    pNormalTimeDesc->ContTime.Roller1.RollerType   = UI_ROLLER_TYPE_HOUR;

    pNormalTimeDesc->ContTime.Roller2.MidValue     = Time.tm_min;
    pNormalTimeDesc->ContTime.Roller2.RollerType   = UI_ROLLER_TYPE_MINUTE;

    pNormalTimeDesc->ButtonBar.ButtonL.Valid       = FALSE;
    pNormalTimeDesc->ButtonBar.ButtonM.Valid       = TRUE;
    pNormalTimeDesc->ButtonBar.ButtonM.ButtonIndex = 1;
    pNormalTimeDesc->ButtonBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
    pNormalTimeDesc->ButtonBar.ButtonR.Valid       = TRUE;
    pNormalTimeDesc->ButtonBar.ButtonR.ButtonIndex = 2;
    pNormalTimeDesc->ButtonBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;

    pNormalTimeDesc->KeyFunc = Display_Setting_Time_Scroll_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow         = UI_Normal_Time_Create;
    FuncList.OnCreate       = NULL;
    FuncList.OnDestroy      = Display_Setting_Time_Scroll_Destroy;
    FuncList.OnSaveState    = Display_Setting_Time_Scroll_OnSaveState;
    FuncList.OnRestoreState = Display_Setting_Time_Scroll_RestoreState;

    gp_SettingTimeSettingCurUIDesc = (VOID *)pNormalTimeDesc;
    g_SettingTimeScrollCaller      = CallerActId;
    Nav_Forward(CallerActId, ACT_ID_SETTING_TIME_SCROLL, &FuncList, pNormalTimeDesc);
} /* Display_Setting_Time_Scroll */

/**
 *
 * Callback of Setting_Time_Format, on destroy
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Format_Destroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc = NULL;

    pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(pNormalLstOnlyDesc->List.ButtonList);
    Hal_Mem_Free(pNormalLstOnlyDesc);
}

/**
 *
 * Callback of Setting_Time_Format, on restore state
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Format_RestoreState(VOID *pNormalLstOnlyDesc)
{
    gp_SettingTimeSettingCurUIDesc = pNormalLstOnlyDesc;
}

/**
 *
 * Callback of Setting_Time_Format, when 24HOUR format selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Time_Format_24HOUR_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

        pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

        pNormalLstOnlyDesc->List.Index = 0;
        Setting_Set_Time_Format(SETTING_TIME_FORMAT_24H);
        Display_Setting_Done(ACT_ID_SETTING_TIME_FORMAT, PHONE_TEXT_ID_24HOUR_SELECTED, ACT_ID_SETTING_TIME_SETTINGS);
    }
}

/**
 *
 * Callback of Setting_Time_Format, when 12HOUR format selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Time_Format_12HOUR_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

        pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

        pNormalLstOnlyDesc->List.Index = 1;
        Setting_Set_Time_Format(SETTING_TIME_FORMAT_12H);
        Display_Setting_Done(ACT_ID_SETTING_TIME_FORMAT, PHONE_TEXT_ID_12HOUR_SELECTED, ACT_ID_SETTING_TIME_SETTINGS);
    }
}

/**
 *
 * Callback of Setting_Time_Format, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Time_Format_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    // UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

    if (KEY_RELEASED != key_sta)
    {
        return(0);
    }

    // pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

    if (KEY_DOWN == key_val)
    {
        // pNormalLstOnlyDesc->List.Index++;
        // pNormalLstOnlyDesc->List.Index %= pNormalLstOnlyDesc->List.ListButtonCnt;
        return(0);
    }
    else if (KEY_UP == key_val)
    {
        // pNormalLstOnlyDesc->List.Index += pNormalLstOnlyDesc->List.ListButtonCnt;
        // pNormalLstOnlyDesc->List.Index--;
        // pNormalLstOnlyDesc->List.Index %= pNormalLstOnlyDesc->List.ListButtonCnt;
        return(0);
    }
    else if (KEY_SOFTRIGHT == key_val)
    {
        Nav_Back(ACT_ID_SETTING_TIME_FORMAT);
        return(1);
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        return(1);
    }
    else
    {
        return(0);
    }
}

/**
 * display Setting_Time_Format
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Time_Format(VOID)
{
    Nav_Func_List_t            FuncList;
    UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

    pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(pNormalLstOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    pNormalLstOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_TIME_FORMAT;
    pNormalLstOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pNormalLstOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    if (SETTING_TIME_FORMAT_24H == g_SettingTimeSettingMng.TimeFormat)
    {
        pNormalLstOnlyDesc->List.Index = 0;
    }
    else
    {
        pNormalLstOnlyDesc->List.Index = 1;
    }
    pNormalLstOnlyDesc->List.ListButtonCnt = 2;
    pNormalLstOnlyDesc->List.ButtonList    = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * 2);
    Hal_Mem_Set(pNormalLstOnlyDesc->List.ButtonList, 0, sizeof(UI_Button_Desc_t) * 2);

    pNormalLstOnlyDesc->List.ButtonList[0].ButtonIndex = 0;
    pNormalLstOnlyDesc->List.ButtonList[0].TxtId       = PHONE_TEXT_ID_24HOUR;
    pNormalLstOnlyDesc->List.ButtonList[0].ReleaseFun  = Display_Setting_Time_Format_24HOUR_Cb;
    pNormalLstOnlyDesc->List.ButtonList[0].Valid       = TRUE;

    pNormalLstOnlyDesc->List.ButtonList[1].ButtonIndex = 1;
    pNormalLstOnlyDesc->List.ButtonList[1].TxtId       = PHONE_TEXT_ID_12HOUR;
    pNormalLstOnlyDesc->List.ButtonList[1].ReleaseFun  = Display_Setting_Time_Format_12HOUR_Cb;
    pNormalLstOnlyDesc->List.ButtonList[1].Valid       = TRUE;

    pNormalLstOnlyDesc->BtnBar.ButtonL.Valid       = FALSE;
    pNormalLstOnlyDesc->BtnBar.ButtonM.Valid       = TRUE;
    pNormalLstOnlyDesc->BtnBar.ButtonM.ButtonIndex = 1;
    pNormalLstOnlyDesc->BtnBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
    pNormalLstOnlyDesc->BtnBar.ButtonR.Valid       = TRUE;
    pNormalLstOnlyDesc->BtnBar.ButtonR.ButtonIndex = 2;
    pNormalLstOnlyDesc->BtnBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;
    pNormalLstOnlyDesc->KeyFunc                    = Display_Setting_Time_Format_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow         = UI_Normal_List_Only_Create;
    FuncList.OnDestroy      = Display_Setting_Time_Format_Destroy;
    FuncList.OnRestoreState = Display_Setting_Time_Format_RestoreState;

    gp_SettingTimeSettingCurUIDesc = (VOID *)pNormalLstOnlyDesc;
    Nav_Forward(ACT_ID_SETTING_CLOCK_SETTING, ACT_ID_SETTING_TIME_FORMAT, &FuncList, pNormalLstOnlyDesc);
} /* Display_Setting_Time_Format */

/**
 *
 * Callback of Setting_Clock_Setting, on destroy
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
VOID Display_Setting_Clock_Setting_Destroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc = NULL;

    pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(pNormalLstOnlyDesc->List.ButtonList);
    Hal_Mem_Free(pNormalLstOnlyDesc);
}

/**
 *
 * Callback of Setting_Clock_Setting, on restore state
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
VOID Display_Setting_Clock_Setting_RestoreState(VOID *pNormalLstOnlyDesc)
{
    gp_SettingTimeSettingCurUIDesc = pNormalLstOnlyDesc;
}

/**
 *
 * Callback of Setting_Clock_Setting, when "set time" item selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Clock_Setting_SetTime_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

        pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

        pNormalLstOnlyDesc->List.Index = 0;
        Display_Setting_Time_Scroll(ACT_ID_SETTING_CLOCK_SETTING);
    }
}

/**
 *
 * Callback of Setting_Clock_Setting, when "time format" item selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Clock_Setting_TimeFormat_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

        pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

        pNormalLstOnlyDesc->List.Index = 1;
        Display_Setting_Time_Format();
    }
}

/**
 *
 * Callback of Setting_Clock_Setting, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Clock_Setting_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    // UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

    if (KEY_RELEASED != key_sta)
    {
        return(0);
    }

    // pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

    if (KEY_DOWN == key_val)
    {
        // pNormalLstOnlyDesc->List.Index++;
        // pNormalLstOnlyDesc->List.Index %= pNormalLstOnlyDesc->List.ListButtonCnt;
        return(0);
    }
    else if (KEY_UP == key_val)
    {
        // pNormalLstOnlyDesc->List.Index += pNormalLstOnlyDesc->List.ListButtonCnt;
        // pNormalLstOnlyDesc->List.Index--;
        // pNormalLstOnlyDesc->List.Index %= pNormalLstOnlyDesc->List.ListButtonCnt;
        return(0);
    }
    else if (KEY_SOFTRIGHT == key_val)
    {
        Nav_Back(ACT_ID_SETTING_CLOCK_SETTING);
        return(1);
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        return(1);
    }
    else
    {
        return(0);
    }
}

/**
 * display Setting_Clock_Setting
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Clock_Setting(VOID)
{
    Nav_Func_List_t            FuncList;
    UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

    pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(pNormalLstOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    pNormalLstOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_CLOCK;
    pNormalLstOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pNormalLstOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    pNormalLstOnlyDesc->List.Index         = 0;
    pNormalLstOnlyDesc->List.ListButtonCnt = 2;
    pNormalLstOnlyDesc->List.ButtonList    = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * 2);
    Hal_Mem_Set(pNormalLstOnlyDesc->List.ButtonList, 0, sizeof(UI_Button_Desc_t) * 2);

    pNormalLstOnlyDesc->List.ButtonList[0].ButtonIndex = 0;
    pNormalLstOnlyDesc->List.ButtonList[0].TxtId       = PHONE_TEXT_ID_SET_TIME;
    pNormalLstOnlyDesc->List.ButtonList[0].ReleaseFun  = Display_Setting_Clock_Setting_SetTime_Cb;
    pNormalLstOnlyDesc->List.ButtonList[0].Valid       = TRUE;

    pNormalLstOnlyDesc->List.ButtonList[1].ButtonIndex = 1;
    pNormalLstOnlyDesc->List.ButtonList[1].TxtId       = PHONE_TEXT_ID_TIME_FORMAT;
    pNormalLstOnlyDesc->List.ButtonList[1].ReleaseFun  = Display_Setting_Clock_Setting_TimeFormat_Cb;
    pNormalLstOnlyDesc->List.ButtonList[1].Valid       = TRUE;

    pNormalLstOnlyDesc->BtnBar.ButtonL.Valid       = FALSE;
    pNormalLstOnlyDesc->BtnBar.ButtonM.Valid       = TRUE;
    pNormalLstOnlyDesc->BtnBar.ButtonM.ButtonIndex = 1;
    pNormalLstOnlyDesc->BtnBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
    pNormalLstOnlyDesc->BtnBar.ButtonR.Valid       = TRUE;
    pNormalLstOnlyDesc->BtnBar.ButtonR.ButtonIndex = 2;
    pNormalLstOnlyDesc->BtnBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;

    pNormalLstOnlyDesc->KeyFunc = Display_Setting_Clock_Setting_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow         = UI_Normal_List_Only_Create;
    FuncList.OnDestroy      = Display_Setting_Clock_Setting_Destroy;
    FuncList.OnRestoreState = Display_Setting_Clock_Setting_RestoreState;

    gp_SettingTimeSettingCurUIDesc = (VOID *)pNormalLstOnlyDesc;
    Nav_Forward(ACT_ID_SETTING_TIME_SETTINGS, ACT_ID_SETTING_CLOCK_SETTING, &FuncList, pNormalLstOnlyDesc);
} /* Display_Setting_Clock_Setting */

VOID Display_Setting_Clock_Setting_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Display_Setting_Clock_Setting();
    }
}

/**
 * Get leap year info for a specified year value
 * param (in) tm_year:INT32
 * return UINT8:
 *          0---normal year
 *          1---leap year
 */
UINT8 Display_Setting_Date_IsLeapYear(INT32 tm_year)
{
    UINT8 LeapYearFlag = 0;

    if (tm_year % 400 == 0)
    {
        LeapYearFlag = 1;
    }
    else
    {
        if ((tm_year % 4 == 0) && (tm_year % 100 != 0))
        {
            LeapYearFlag = 1;
        }
    }
    return(LeapYearFlag);
}

/**
 *
 * Callback of Setting_Date_Scroll, on destroy
 * param (in) pNormalDateDesc: UI_Normal_Date_Desc_t*
 * return void:
 */
VOID Display_Setting_Date_Scroll_Destroy(VOID *pPara)
{
    Hal_Mem_Free(pPara);
}
/**
 *
 * Callback of Setting_Date_Scroll, on save state
 * param (in) pNormalDateDesc: UI_Normal_Date_Desc_t*
 * return void:
 */
VOID Display_Setting_Date_Scroll_SaveState(VOID *pPara)
{
    UI_Normal_Date_Desc_t *pNormalDateDesc = (UI_Normal_Date_Desc_t *)pPara;
    INT8 Buf[5] = {0};

    lv_roller_get_selected_str(pNormalDateDesc->ContDate.RollerDay.Roller, Buf, 5);
    pNormalDateDesc->ContDate.RollerDay.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pNormalDateDesc->ContDate.RollerMonth.Roller, Buf, 5);
    pNormalDateDesc->ContDate.RollerMonth.MidValue = atoi(Buf);
    lv_roller_get_selected_str(pNormalDateDesc->ContDate.RollerYear.Roller, Buf, 5);
    pNormalDateDesc->ContDate.RollerYear.MidValue = atoi(Buf);
}

/**
 *
 * Callback of Setting_Date_Scroll, on restore state
 * param (in) pNormalDateDesc: UI_Normal_Date_Desc_t*
 * return void:
 */
VOID Display_Setting_Date_Scroll_RestoreState(VOID *pPara)
{
    gp_SettingTimeSettingCurUIDesc = (VOID *)pPara;
}


/**
 *
 * Callback of Setting_Date_Scroll, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Date_Scroll_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    hal_rtc_t             Time;
    UI_Normal_Date_Desc_t *pNormalDateDesc;
    INT8                  Buf[5];

    if (KEY_RELEASED != key_sta)
    {
        return(0);
    }

    pNormalDateDesc = (UI_Normal_Date_Desc_t *)gp_SettingTimeSettingCurUIDesc;

    if (KEY_OK == key_val)
    {
        // Get the current date
        Setting_Get_Rtc_Time(&Time);

        // set new date according to roller options
        // Get latest selected year
        lv_roller_get_selected_str(pNormalDateDesc->ContDate.RollerYear.Roller, Buf, 5);
        Time.tm_year = atoi(Buf);

        // Get latest month & day
        lv_roller_get_selected_str(pNormalDateDesc->ContDate.RollerMonth.Roller, Buf, 5);
        Time.tm_mon  = atoi(Buf);
        lv_roller_get_selected_str(pNormalDateDesc->ContDate.RollerDay.Roller, Buf, 5);
        Time.tm_mday = atoi(Buf);

        // set RTC using new date
        Setting_Set_Rtc_Time(&Time);
        Setting_Set_Time_Auto_Update(SETTING_TIME_AUTO_UPDATE_OFF);

        // return to previous UI
        // Nav_Back(ACT_ID_SETTING_DATE_SCROLL);
        Display_Setting_Done(ACT_ID_SETTING_DATE_SCROLL, PHONE_TEXT_ID_DATE_IS_SET, ACT_ID_SETTING_TIME_SETTINGS);

        return(1);
    }
    else if (KEY_SOFTRIGHT == key_val)
    {
        Nav_Back(ACT_ID_ANY);
        return(1);
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        return(1);
    }
    else
    {
        return(0);
    }
} /* Display_Setting_Date_Scroll_KeyCb */

/**
 * display Setting_Date_Scroll
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Date_Scroll(VOID)
{
    hal_rtc_t             Time;
    Nav_Func_List_t       FuncList;
    UI_Normal_Date_Desc_t *pNormalDateDesc;

    // Alloc memory for date scroll UI display
    pNormalDateDesc = Hal_Mem_Alloc(sizeof(UI_Normal_Date_Desc_t));
    Hal_Mem_Set(pNormalDateDesc, 0, sizeof(UI_Normal_Date_Desc_t));

    // Set the UI description parameters
    pNormalDateDesc->TitleBar.TxtId      = PHONE_TEXT_ID_DATE;
    pNormalDateDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pNormalDateDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    Setting_Get_Rtc_Time(&Time);
    pNormalDateDesc->ContDate.RollerDay.RollerType = UI_ROLLER_TYPE_DAY;
    pNormalDateDesc->ContDate.RollerDay.MidValue   = Time.tm_mday;

    pNormalDateDesc->ContDate.RollerMonth.RollerType = UI_ROLLER_TYPE_MONTH;
    pNormalDateDesc->ContDate.RollerMonth.MidValue   = Time.tm_mon;

    pNormalDateDesc->ContDate.RollerYear.RollerType = UI_ROLLER_TYPE_YEAR;
    pNormalDateDesc->ContDate.RollerYear.MidValue   = Time.tm_year;

    pNormalDateDesc->ButtonBar.ButtonL.Valid       = FALSE;
    pNormalDateDesc->ButtonBar.ButtonM.Valid       = TRUE;
    pNormalDateDesc->ButtonBar.ButtonM.ButtonIndex = 1;
    pNormalDateDesc->ButtonBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
    pNormalDateDesc->ButtonBar.ButtonR.Valid       = TRUE;
    pNormalDateDesc->ButtonBar.ButtonR.ButtonIndex = 2;
    pNormalDateDesc->ButtonBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;
    pNormalDateDesc->KeyFunc                       = Display_Setting_Date_Scroll_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow    = UI_Normal_Date_Create;
    FuncList.OnCreate  = NULL;
    FuncList.OnDestroy = Display_Setting_Date_Scroll_Destroy;
    FuncList.OnSaveState    = Display_Setting_Date_Scroll_SaveState;
    FuncList.OnRestoreState = Display_Setting_Date_Scroll_RestoreState;

    gp_SettingTimeSettingCurUIDesc = (VOID *)pNormalDateDesc;
    Nav_Forward(ACT_ID_SETTING_TIME_SETTINGS, ACT_ID_SETTING_DATE_SCROLL, &FuncList, pNormalDateDesc);
} /* Display_Setting_Date_Scroll */

VOID Display_Setting_Date_Scroll_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Display_Setting_Date_Scroll();
    }
}

/**
 *
 * Callback of Setting_Display_Time_Date, on destroy
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
VOID Display_Setting_Display_Time_Date_Destroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc = NULL;

    pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(pNormalLstOnlyDesc->List.ButtonList);
    Hal_Mem_Free(pNormalLstOnlyDesc);
}

/**
 *
 * Callback of Setting_Display_Time_Date, on restore state
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
VOID Display_Setting_Display_Time_Date_RestoreState(VOID *pNormalLstOnlyDesc)
{
    gp_SettingTimeSettingCurUIDesc = (VOID *)pNormalLstOnlyDesc;
}

/**
 *
 * Callback of Setting_Display_Time_Date, when "show clock" item selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Display_Time_Date_ShowClock_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t      *pNormalLstOnlyDesc = NULL;
        UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

        pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;
        pNormalContLstDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingTimeSettingCurContainerListUIDesc;

        pNormalLstOnlyDesc->List.Index = 0;
        Setting_Set_Time_Display(SETTING_TIME_SHOW);
        pNormalContLstDesc->ContList.ContainerList[pNormalContLstDesc->ContList.Index].u.Label2.TxtId = PHONE_TEXT_ID_SHOW_CLOCK;

        Display_Setting_Done(ACT_ID_SETTING_DISPLAY_TIME_DATE,PHONE_TEXT_ID_CLOCK_SHOWN,ACT_ID_SETTING_TIME_SETTINGS);
    }
}

/**
 *
 * Callback of Setting_Display_Time_Date, when "hide clock" item selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Display_Time_Date_HideClock_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t      *pNormalLstOnlyDesc = NULL;
        UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

        pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;
        pNormalContLstDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingTimeSettingCurContainerListUIDesc;

        pNormalLstOnlyDesc->List.Index = 1;
        Setting_Set_Time_Display(SETTING_TIME_HIDE);
        pNormalContLstDesc->ContList.ContainerList[pNormalContLstDesc->ContList.Index].u.Label2.TxtId = PHONE_TEXT_ID_HIDE_CLOCK;

        Display_Setting_Done(ACT_ID_SETTING_DISPLAY_TIME_DATE,PHONE_TEXT_ID_CLOCK_HIDDEN,ACT_ID_SETTING_TIME_SETTINGS);
    }
}

/**
 *
 * Callback of Setting_Display_Time_Date, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Display_Time_Date_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    // UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

    if (KEY_RELEASED != key_sta)
    {
        return(0);
    }

    // pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingTimeSettingCurUIDesc;

    if (KEY_SOFTRIGHT == key_val)
    {
        Nav_Back(ACT_ID_SETTING_DISPLAY_TIME_DATE);
        return(1);
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        return(1);
    }
    else
    {
        return(0);
    }
}

/**
 * Display Setting_Display_Time_Date
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Display_Time_Date(VOID)
{
    Nav_Func_List_t            FuncList;
    UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;

    pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(pNormalLstOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    pNormalLstOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_DIS_TIME_DATE;
    pNormalLstOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pNormalLstOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    if (SETTING_TIME_SHOW == g_SettingTimeSettingMng.TimeDisplay)
    {
        pNormalLstOnlyDesc->List.Index = 0;
    }
    else
    {
        pNormalLstOnlyDesc->List.Index = 1;
    }

    pNormalLstOnlyDesc->List.ListButtonCnt = 2;
    pNormalLstOnlyDesc->List.ButtonList    = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * 2);
    Hal_Mem_Set(pNormalLstOnlyDesc->List.ButtonList, 0, sizeof(UI_Button_Desc_t) * 2);

    pNormalLstOnlyDesc->List.ButtonList[0].ButtonIndex = 0;
    pNormalLstOnlyDesc->List.ButtonList[0].TxtId       = PHONE_TEXT_ID_SHOW_CLOCK;
    pNormalLstOnlyDesc->List.ButtonList[0].ReleaseFun  = Display_Setting_Display_Time_Date_ShowClock_Cb;
    pNormalLstOnlyDesc->List.ButtonList[0].Valid       = TRUE;

    pNormalLstOnlyDesc->List.ButtonList[1].ButtonIndex = 1;
    pNormalLstOnlyDesc->List.ButtonList[1].TxtId       = PHONE_TEXT_ID_HIDE_CLOCK;
    pNormalLstOnlyDesc->List.ButtonList[1].ReleaseFun  = Display_Setting_Display_Time_Date_HideClock_Cb;
    pNormalLstOnlyDesc->List.ButtonList[1].Valid       = TRUE;

    pNormalLstOnlyDesc->BtnBar.ButtonL.Valid       = FALSE;
    pNormalLstOnlyDesc->BtnBar.ButtonM.Valid       = TRUE;
    pNormalLstOnlyDesc->BtnBar.ButtonM.ButtonIndex = 1;
    pNormalLstOnlyDesc->BtnBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
    pNormalLstOnlyDesc->BtnBar.ButtonR.Valid       = TRUE;
    pNormalLstOnlyDesc->BtnBar.ButtonR.ButtonIndex = 2;
    pNormalLstOnlyDesc->BtnBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;
    pNormalLstOnlyDesc->KeyFunc                    = Display_Setting_Display_Time_Date_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow         = UI_Normal_List_Only_Create;
    FuncList.OnDestroy      = Display_Setting_Display_Time_Date_Destroy;
    FuncList.OnRestoreState = Display_Setting_Display_Time_Date_RestoreState;

    gp_SettingTimeSettingCurUIDesc = (VOID *)pNormalLstOnlyDesc;
    Nav_Forward(ACT_ID_SETTING_TIME_SETTINGS, ACT_ID_SETTING_DISPLAY_TIME_DATE, &FuncList, pNormalLstOnlyDesc);
} /* Display_Setting_Display_Time_Date */

VOID Display_Setting_Display_Time_Date_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Display_Setting_Display_Time_Date();
    }
}

/**
 *
 * Callback of Setting_Auto_Update_Time, on restore state
 * param (in) pNormalLstOnlyDesc: UI_Normal_List_Only_Desc_t*
 * return void:
 */
// VOID Display_Setting_Auto_Update_Time_RestoreState(UI_Normal_List_Only_Desc_t* pNormalLstOnlyDesc)
// {
// gp_SettingTimeSettingCurUIDesc = (VOID*)pNormalLstOnlyDesc;
// }

/**
 *
 * Callback of Setting_Auto_Update_Time, when "ON" item selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Auto_Update_Time_On_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

        pNormalContLstDesc                                                                            = (UI_Normal_Container_List_Desc_t *)gp_SettingTimeSettingCurContainerListUIDesc;
        pNormalContLstDesc->ContList.ContainerList[pNormalContLstDesc->ContList.Index].u.Label2.TxtId = PHONE_TEXT_ID_ON;
        Setting_Set_Time_Auto_Update(SETTING_TIME_AUTO_UPDATE_ON);
        Setting_Set_Rtc_Time(NULL);

        Display_Setting_Done(ACT_ID_SETTING_ON_OFF,PHONE_TEXT_ID_AUTO_UPDATEON,ACT_ID_SETTING_TIME_SETTINGS);

        Setting_Time_Change_Ind();
    }
}

/**
 *
 * Callback of Setting_Auto_Update_Time, when "Off" item selected
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Auto_Update_Time_Off_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

        pNormalContLstDesc                                                                            = (UI_Normal_Container_List_Desc_t *)gp_SettingTimeSettingCurContainerListUIDesc;
        pNormalContLstDesc->ContList.ContainerList[pNormalContLstDesc->ContList.Index].u.Label2.TxtId = PHONE_TEXT_ID_OFF;
        Setting_Set_Time_Auto_Update(SETTING_TIME_AUTO_UPDATE_OFF);

        Display_Setting_Done(ACT_ID_SETTING_ON_OFF,PHONE_TEXT_ID_AUTO_UPDATEOFF,ACT_ID_SETTING_TIME_SETTINGS);
    }
}

/**
 *
 * Callback of Setting_Auto_Update_Time, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
// UINT8 Display_Setting_Auto_Update_Time_KeyCb (lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
// {
// UI_Normal_List_Only_Desc_t     *pNormalLstOnlyDesc;
//
// if(KEY_RELEASED != key_sta)
// return 0;
//
// pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t*)gp_SettingTimeSettingCurUIDesc;
//
// if(KEY_DOWN == key_val)
// {
////pNormalLstOnlyDesc->List.Index++;
////pNormalLstOnlyDesc->List.Index %= pNormalLstOnlyDesc->List.ListButtonCnt;
// return 0;
// }
// else if(KEY_UP == key_val)
// {
////pNormalLstOnlyDesc->List.Index += pNormalLstOnlyDesc->List.ListButtonCnt;
////pNormalLstOnlyDesc->List.Index--;
////pNormalLstOnlyDesc->List.Index %= pNormalLstOnlyDesc->List.ListButtonCnt;
// return 0;
// }
// else if(KEY_OK == key_val)
// {
// return 1;
// }
// else if(KEY_SOFTRIGHT == key_val)
// {
// Nav_Back(ACT_ID_SETTING_AUTO_UPDATE_TIME);
// return 1;
// }
// else
// {
// return 0;
// }
// }

/**
 * Display Setting_Auto_Update_Time
 * param (in) void:
 * return void:
 */
// VOID Display_Setting_Auto_Update_Time(VOID)
// {
// Nav_Func_List_t             FuncList;
// UI_Normal_List_Only_Desc_t *pNormalLstOnlyDesc;
//
// pNormalLstOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
// Hal_Mem_Set(pNormalLstOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));
//
// pNormalLstOnlyDesc->TitleBar.TxtId = PHONE_TEXT_ID_AUTO_UPDATE;
// pNormalLstOnlyDesc->TitleBar.SymbolId = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->TitleBar.TxtFont = FP_FONT_1;
// pNormalLstOnlyDesc->TitleBar.TxtAlign = LV_LABEL_ALIGN_CENTER;
// pNormalLstOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
//
// if(SETTING_TIME_AUTO_UPDATE_ON == g_SettingTimeSettingMng.TimeAutoUpdate)
// {
// pNormalLstOnlyDesc->List.Index = 0;
// }
// else
// {
// pNormalLstOnlyDesc->List.Index = 1;
// }
// pNormalLstOnlyDesc->List.ListButtonCnt             = 2;
// pNormalLstOnlyDesc->List.ButtonList                = (UI_Button_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Button_Desc_t) * 2);
// pNormalLstOnlyDesc->List.ButtonList[0].ButtonIndex = 0;
// pNormalLstOnlyDesc->List.ButtonList[0].TxtId       = PHONE_TEXT_ID_ON;
// pNormalLstOnlyDesc->List.ButtonList[0].SymbolId1   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->List.ButtonList[0].SymbolId2   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->List.ButtonList[0].ReleaseFun  = Display_Setting_Auto_Update_Time_On_Cb;
// pNormalLstOnlyDesc->List.ButtonList[0].Valid       = TRUE;
//
// pNormalLstOnlyDesc->List.ButtonList[1].ButtonIndex = 1;
// pNormalLstOnlyDesc->List.ButtonList[1].TxtId       = PHONE_TEXT_ID_OFF;
// pNormalLstOnlyDesc->List.ButtonList[1].SymbolId1   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->List.ButtonList[1].SymbolId2   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->List.ButtonList[1].ReleaseFun  = Display_Setting_Auto_Update_Time_Off_Cb;
// pNormalLstOnlyDesc->List.ButtonList[1].Valid       = TRUE;
//
// pNormalLstOnlyDesc->ButtonBar.ButtonL.Valid       = FALSE;
// pNormalLstOnlyDesc->ButtonBar.ButtonM.Valid       = TRUE;
// pNormalLstOnlyDesc->ButtonBar.ButtonM.ButtonIndex = 1;
// pNormalLstOnlyDesc->ButtonBar.ButtonM.TxtId       = PHONE_TEXT_ID_OK;
// pNormalLstOnlyDesc->ButtonBar.ButtonM.SymbolId1   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->ButtonBar.ButtonM.SymbolId2   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->ButtonBar.ButtonR.Valid       = TRUE;
// pNormalLstOnlyDesc->ButtonBar.ButtonR.ButtonIndex = 2;
// pNormalLstOnlyDesc->ButtonBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;
// pNormalLstOnlyDesc->ButtonBar.ButtonR.SymbolId1   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->ButtonBar.ButtonR.SymbolId2   = LV_LANG_SYMBOL_ID_NONE;
// pNormalLstOnlyDesc->KeyFunc = Display_Setting_Auto_Update_Time_KeyCb;
//
// Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
// FuncList.OnShow         = UI_Normal_List_Only_Create;
// FuncList.OnDestroy      = UI_Normal_List_Only_Destroy;
// FuncList.OnRestoreState = Display_Setting_Auto_Update_Time_RestoreState;
//
// gp_SettingTimeSettingCurUIDesc = (VOID*)pNormalLstOnlyDesc;
// Nav_Forward(ACT_ID_SETTING_TIME_SETTINGS, ACT_ID_SETTING_AUTO_UPDATE_TIME, &FuncList, pNormalLstOnlyDesc);
// }

VOID Display_Setting_Auto_Update_Time_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UINT8 CurTimeAutoUpdateSetting = 0;       // 0:OFF, 1:ON

        if (SETTING_TIME_AUTO_UPDATE_ON == g_SettingTimeSettingMng.TimeAutoUpdate)
        {
            CurTimeAutoUpdateSetting = 1;
        }
        else
        {
            CurTimeAutoUpdateSetting = 0;
        }
        // Display_Setting_Auto_Update_Time();
        Display_Setting_On_Off(ACT_ID_SETTING_TIME_SETTINGS,PHONE_TEXT_ID_AUTO_UPDATE,CurTimeAutoUpdateSetting,Display_Setting_Auto_Update_Time_On_Cb,Display_Setting_Auto_Update_Time_Off_Cb);
    }
}

/**
 *
 * Callback of Setting_Time_Settings, on create
 * param (in) pNormalContLstDesc: UI_Normal_Container_List_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Settings_Create(VOID *pPara)
{
    hal_rtc_t                       Time;
    INT8                            LabelValue[15];
    UINT8                           AmPmFlag; // 0--AM(0:00-11:59), 1--PM(12:00-23:59)
    UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

    pNormalContLstDesc = (UI_Normal_Container_List_Desc_t *)pPara;

    // Get the current time & AM/PM flag
    Setting_Get_Rtc_Time(&Time);
    if (Time.tm_hour > 11)
    {
        AmPmFlag = 1;
    }
    else
    {
        AmPmFlag = 0;
    }

    // set the clock value label
    Hal_Mem_Set(LabelValue, 0, 15);
    if (SETTING_TIME_FORMAT_24H == g_SettingTimeSettingMng.TimeFormat)
    {
        LabelValue[0] = Time.tm_hour / 10 + 0x30;
        LabelValue[1] = Time.tm_hour % 10 + 0x30;
    }
    else                   // 12-HOUR format
    {
        if (0 == AmPmFlag) // AM
        {
            if (0 == Time.tm_hour)
            {
                LabelValue[0] = '1';
                LabelValue[1] = '2';
            }
            else
            {
                LabelValue[0] = Time.tm_hour / 10 + 0x30;
                LabelValue[1] = Time.tm_hour % 10 + 0x30;
            }
            LabelValue[6] = 'a';
        }
        else               // PM
        {
            if (12 == Time.tm_hour)
            {
                LabelValue[0] = '1';
                LabelValue[1] = '2';
            }
            else
            {
                LabelValue[0] = (Time.tm_hour - 12) / 10 + 0x30;
                LabelValue[1] = (Time.tm_hour - 12) % 10 + 0x30;
            }
            LabelValue[6] = 'p';
        }
        LabelValue[5] = ' ';
        LabelValue[7] = 'm';
    }
    LabelValue[2] = ':';
    LabelValue[3] = Time.tm_min / 10 + 0x30;
    LabelValue[4] = Time.tm_min % 10 + 0x30;
    lv_label_set_text(pNormalContLstDesc->ContList.ContainerList[0].u.Label2.Label, LabelValue);

    // set the date value lable
    Hal_Mem_Set(LabelValue, 0, 15);
    LabelValue[0] = Time.tm_mday / 10 + 0x30;
    LabelValue[1] = Time.tm_mday % 10 + 0x30;
    LabelValue[2] = '.';
    LabelValue[3] = Time.tm_mon / 10 + 0x30;
    LabelValue[4] = Time.tm_mon % 10 + 0x30;
    LabelValue[5] = '.';
    LabelValue[6] = Time.tm_year / 1000 + 0x30;
    LabelValue[7] = (Time.tm_year % 1000) / 100 + 0x30;
    LabelValue[8] = (Time.tm_year % 100) / 10 + 0x30;
    LabelValue[9] = Time.tm_year % 10 + 0x30;
    lv_label_set_text(pNormalContLstDesc->ContList.ContainerList[1].u.Label2.Label, LabelValue);

    if (SETTING_TIME_AUTO_UPDATE_OFF == g_SettingTimeSettingMng.TimeAutoUpdate)
    {
        pNormalContLstDesc->ContList.ContainerList[3].u.Label2.TxtId = PHONE_TEXT_ID_OFF;
    }
    else
    {
        pNormalContLstDesc->ContList.ContainerList[3].u.Label2.TxtId = PHONE_TEXT_ID_ON;
    }
    lv_label_set_text(pNormalContLstDesc->ContList.ContainerList[3].u.Label2.Label, UI_Lang_Get_Text_ById(pNormalContLstDesc->ContList.ContainerList[3].u.Label2.TxtId));
} /* Display_Setting_Time_Settings_Create */

/**
 *
 * Callback of Setting_Time_Settings, on destroy
 * param (in) pNormalContLstDesc: UI_Normal_Container_List_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Settings_Destroy(VOID *pPara)
{
    UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

    pNormalContLstDesc = (UI_Normal_Container_List_Desc_t *)pPara;

    Hal_Mem_Free(pNormalContLstDesc->ContList.ContainerList);
    Hal_Mem_Free(pNormalContLstDesc);
}

/**
 *
 * Callback of Setting_Time_Settings, on restore state
 * param (in) pNormalContLstDesc: UI_Normal_Container_List_Desc_t*
 * return void:
 */
VOID Display_Setting_Time_Settings_RestoreState(VOID *pPara)
{
    UI_Normal_Container_List_Desc_t *pNormalContLstDesc = NULL;

    pNormalContLstDesc = (UI_Normal_Container_List_Desc_t *)pPara;

    Display_Setting_Time_Settings_Create(pNormalContLstDesc);

    gp_SettingTimeSettingCurContainerListUIDesc = (VOID *)pNormalContLstDesc;
}

/**
 *
 * Callback of Setting_Time_Settings, KeyCb
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Time_Settings_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UI_Normal_Container_List_Desc_t *pNormalContLstDesc;

    if (KEY_RELEASED != key_sta)
    {
        return(0);
    }

    pNormalContLstDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingTimeSettingCurContainerListUIDesc;

    if (KEY_DOWN == key_val)
    {
        pNormalContLstDesc->ContList.Index++;
        pNormalContLstDesc->ContList.Index %= pNormalContLstDesc->ContList.ListContainerCnt;
        return(0);
    }
    else if (KEY_UP == key_val)
    {
        pNormalContLstDesc->ContList.Index += pNormalContLstDesc->ContList.ListContainerCnt;
        pNormalContLstDesc->ContList.Index--;
        pNormalContLstDesc->ContList.Index %= pNormalContLstDesc->ContList.ListContainerCnt;
        return(0);
    }
    else if (KEY_SOFTRIGHT == key_val)   // BACK
    {
        Nav_Back(ACT_ID_SETTING_TIME_SETTINGS);
        return(1);
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        return(1);
    }
    else
    {
        return(0);
    }
} /* Display_Setting_Time_Settings_KeyCb */

/**
 * display Setting_Time_Settings
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Time_Settings(VOID)
{
    Nav_Func_List_t                 FuncList;
    UI_Normal_Container_List_Desc_t *pNormalContLstDesc;

    // Alloc memory for time setting UI display
    pNormalContLstDesc = Hal_Mem_Alloc(sizeof(UI_Normal_Container_List_Desc_t));
    Hal_Mem_Set(pNormalContLstDesc, 0, sizeof(UI_Normal_Container_List_Desc_t));

    pNormalContLstDesc->TitleBar.TxtId      = PHONE_TEXT_ID_TIME_SET;
    pNormalContLstDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    pNormalContLstDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    pNormalContLstDesc->ContList.ListContainerCnt = 4;
    pNormalContLstDesc->ContList.Index            = 0;
    pNormalContLstDesc->ContList.ContainerList    = Hal_Mem_Alloc(sizeof(UI_Container_Base_Desc_t) * pNormalContLstDesc->ContList.ListContainerCnt);
    Hal_Mem_Set(pNormalContLstDesc->ContList.ContainerList, 0, sizeof(UI_Container_Base_Desc_t) * pNormalContLstDesc->ContList.ListContainerCnt);

    pNormalContLstDesc->ContList.ContainerList[0].Label.TxtId         = PHONE_TEXT_ID_CLOCK;
    pNormalContLstDesc->ContList.ContainerList[0].Label.TxtAlign      = LV_LABEL_ALIGN_LEFT;
    pNormalContLstDesc->ContList.ContainerList[0].Label.LabelAlign    = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[0].Valid               = TRUE;
    pNormalContLstDesc->ContList.ContainerList[0].Choise              = UI_BASE_OBJ_LABEL;
    pNormalContLstDesc->ContList.ContainerList[0].u.Label2.TxtAlign   = LV_LABEL_ALIGN_RIGHT;
    pNormalContLstDesc->ContList.ContainerList[0].u.Label2.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[0].ReleaseFunc         = Display_Setting_Clock_Setting_Cb;

    pNormalContLstDesc->ContList.ContainerList[1].Label.TxtId         = PHONE_TEXT_ID_DATE_SET;
    pNormalContLstDesc->ContList.ContainerList[1].Label.TxtAlign      = LV_LABEL_ALIGN_LEFT;
    pNormalContLstDesc->ContList.ContainerList[1].Label.LabelAlign    = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[1].Valid               = TRUE;
    pNormalContLstDesc->ContList.ContainerList[1].Choise              = UI_BASE_OBJ_LABEL;
    pNormalContLstDesc->ContList.ContainerList[1].u.Label2.TxtAlign   = LV_LABEL_ALIGN_RIGHT;
    pNormalContLstDesc->ContList.ContainerList[1].u.Label2.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[1].ReleaseFunc         = Display_Setting_Date_Scroll_Cb;

    pNormalContLstDesc->ContList.ContainerList[2].Label.TxtId      = PHONE_TEXT_ID_DIS_TIME_DATE;
    pNormalContLstDesc->ContList.ContainerList[2].Label.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    pNormalContLstDesc->ContList.ContainerList[2].Label.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[2].Valid            = TRUE;
    pNormalContLstDesc->ContList.ContainerList[2].Choise           = UI_BASE_OBJ_LABEL;
    if (SETTING_TIME_HIDE == g_SettingTimeSettingMng.TimeDisplay)
    {
        pNormalContLstDesc->ContList.ContainerList[2].u.Label2.TxtId = PHONE_TEXT_ID_HIDE_CLOCK;
    }
    else
    {
        pNormalContLstDesc->ContList.ContainerList[2].u.Label2.TxtId = PHONE_TEXT_ID_SHOW_CLOCK;
    }
    pNormalContLstDesc->ContList.ContainerList[2].u.Label2.TxtAlign   = LV_LABEL_ALIGN_RIGHT;
    pNormalContLstDesc->ContList.ContainerList[2].u.Label2.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[2].ReleaseFunc         = Display_Setting_Display_Time_Date_Cb;

    pNormalContLstDesc->ContList.ContainerList[3].Label.TxtId      = PHONE_TEXT_ID_AUTO_UPDATE;
    pNormalContLstDesc->ContList.ContainerList[3].Label.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    pNormalContLstDesc->ContList.ContainerList[3].Label.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[3].Valid            = TRUE;
    pNormalContLstDesc->ContList.ContainerList[3].Choise           = UI_BASE_OBJ_LABEL;
    if (SETTING_TIME_AUTO_UPDATE_OFF == g_SettingTimeSettingMng.TimeAutoUpdate)
    {
        pNormalContLstDesc->ContList.ContainerList[3].u.Label2.TxtId = PHONE_TEXT_ID_OFF;
    }
    else
    {
        pNormalContLstDesc->ContList.ContainerList[3].u.Label2.TxtId = PHONE_TEXT_ID_ON;
    }
    pNormalContLstDesc->ContList.ContainerList[3].u.Label2.TxtAlign   = LV_LABEL_ALIGN_RIGHT;
    pNormalContLstDesc->ContList.ContainerList[3].u.Label2.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    pNormalContLstDesc->ContList.ContainerList[3].ReleaseFunc         = Display_Setting_Auto_Update_Time_Cb;

    pNormalContLstDesc->ButtonBar.ButtonL.Valid       = FALSE;
    pNormalContLstDesc->ButtonBar.ButtonM.Valid       = TRUE;
    pNormalContLstDesc->ButtonBar.ButtonM.ButtonIndex = 1;
    pNormalContLstDesc->ButtonBar.ButtonM.TxtId       = PHONE_TEXT_ID_SELECT;
    pNormalContLstDesc->ButtonBar.ButtonR.Valid       = TRUE;
    pNormalContLstDesc->ButtonBar.ButtonR.ButtonIndex = 2;
    pNormalContLstDesc->ButtonBar.ButtonR.TxtId       = PHONE_TEXT_ID_BACK;
    pNormalContLstDesc->KeyFunc                       = Display_Setting_Time_Settings_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow         = UI_Normal_Container_List_Create;
    FuncList.OnCreate       = Display_Setting_Time_Settings_Create;
    FuncList.OnDestroy      = Display_Setting_Time_Settings_Destroy;
    FuncList.OnRestoreState = Display_Setting_Time_Settings_RestoreState;

    gp_SettingTimeSettingCurContainerListUIDesc = (VOID *)pNormalContLstDesc;
    Nav_Forward(ACT_ID_SETTING, ACT_ID_SETTING_TIME_SETTINGS, &FuncList, pNormalContLstDesc);
} /* Display_Setting_Time_Settings */

VOID Display_Setting_Time_Settings_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if(LV_EVENT_CLICKED == Event)
    {
        Display_Setting_Time_Settings();
    }
}
